#include "RepulseField.h"
#include "World.h"

RepulseField::~RepulseField(void)
{
}

Vector2 RepulseField::get_trajectory(Vector2 & tank_loc) {
	Vector2 v = Vector2(tank_loc.x - _loc.x,  tank_loc.y - _loc.y);

	if (v.magnitude() < _radius)
		return v.normalize();
	else if (v.magnitude() < 2 * _radius)
		return v.normalize() * (1.0 / (1 + (v.magnitude() - _radius)));
	else
		return v * 0;
}
